function setCookie(name,value,day,path,domain,secure){
    var strCookie="";
    if(name&&value){
        strCookie+=encodeURIComponent(name)+"="+encodeURIComponent(value)+";"
    }
    if(typeof(day)=="number"){
        var date=new Date();
        date.setDate(date.getDate()+day);
        strCookie+="expires="+date.toUTCString()+";";
    }
    if(path){
        strCookie+="path=";
    }
    if(domain){
        strCookie+"domain=";
    }
    if(secure){
        strCookie+="secure";
    }
    return document.cookie=strCookie
}
function getCookieAll(){
    var obj={};
    var cookie=decodeURIComponent(document.cookie);
    var arr=cookie.split(";");
    for(var i=0;i<arr.length;i++){
        var newArr=arr[i].split("=");
        obj[newArr[0].trim()]=newArr[1]
    }
    return obj;
}
function getCookieByName(name){
    var obj=getCookieAll();
    return obj[name];
}
function removeCookie(name){
    var date=new Date();
    date.setDate(date.getDate()-1);
    document.cookie=encodeURIComponent(name)+"= ;expires="+date.toUTCString()
}